﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace addclass
{
    class Program
    {
        static void Main(string[] args)
        {
            string com = "";
            while (true)
            {
                Console.Write("com<");
                com = Console.ReadLine();
                if (com == "cip") BlockLists.bSetNullTable(0);
                else
                    if (com == "cname") BlockLists.bSetNullTable(1);
                    else
                        if (com == "wip") BlockLists.bWriteTable(0);
                        else
                            if (com == "wname") BlockLists.bWriteTable(1);
                            else
                                if (com == "aub") { BlockLists.bAutoUnBan(0); BlockLists.bAutoUnBan(1); }
                                else
                                {
                                    string[] ub = com.Replace("\r\n", " ").Split(' ');
                                    if (ub[0] == "bip")
                                    {
                                        if (ub.Length == 5)
                                        {
                                            BlockLists.bAddBan(0, ub[1], ub[2], ub[3], ub[4]);
                                        }
                                        else Console.WriteLine("command bip error");
                                    }
                                    if (ub[0] == "bname")
                                    {
                                        if (ub.Length == 5)
                                        {
                                            BlockLists.bAddBan(1, ub[1], ub[2], ub[3], ub[4]);
                                        }
                                        else Console.WriteLine("command bname error");
                                    }
                                    if (ub[0] == "ubip")
                                    {
                                        if (ub.Length == 2)
                                        {
                                            if (BlockLists.bUnBan(0, ub[1])) Console.WriteLine("Yes!");
                                            else
                                                Console.WriteLine("No!");
                                        }
                                        else Console.WriteLine("command ubip error");
                                    }
                                    if (ub[0] == "uname")
                                    {
                                        if (ub.Length == 2)
                                        {
                                            if (BlockLists.bUnBan(1, ub[1])) Console.WriteLine("Yes!");
                                            else
                                                Console.WriteLine("No!");
                                        }
                                        else Console.WriteLine("command uname error");
                                    }
                                }
            }
        }
    }
}
